<template>
  <div class="my-container">
    <!-- 头像 -->
    <div class="avatar_info" >
      <div class="base-info">
        <div class="left">
         <!-- <van-image
          v-imagerror="defaultImg"
          class="avatar"
          :src="$store.state.user.userDetailInfo.avarta"
          fit="cover"
          round
          @click="ImagePreview"
        /> -->
        <img
        @click="ImagePreview"
        class="avatar"
        v-imagerror="defaultImg"
        :src="$store.state.user.userDetailInfo.avarta"
         alt="">
          <div class="span">
            <p >{{$store.state.user.userDetailInfo.nichen}}</p>
           <p>{{$store.state.user.userDetailInfo.mobile}}</p>
          </div>
        </div>
        <div class="right">
          <van-button size="samll" round  to="info">编辑资料</van-button>
        </div>
      </div>

    </div>
<!-- 宫格导航 -->
    <van-grid class="grid-nav mb-9" :column-num="3" clickable>
      <van-grid-item class="grid-item">
        <i slot="icon" class="toutiao toutiao-shoucang"></i>
        <span slot="text" class="text">安全学</span>
      </van-grid-item>
      <van-grid-item class="grid-item">
        <i slot="icon" class="toutiao toutiao-lishi"></i>
        <span slot="text" class="text">安全看</span>
      </van-grid-item>
      <van-grid-item class="grid-item">
        <i slot="icon" class="toutiao toutiao-lishi"></i>
        <span slot="text" class="text">安全交底</span>
      </van-grid-item>
    </van-grid>
    <!-- /宫格导航 -->

    <div class="grid-nav"></div>
    <van-cell icon="friends-o" title="联系人" is-link url=""  to="contact"/>
    <van-cell icon="award-o" title="我要反馈" is-link url="" to="feedback"/>
    <van-cell icon="share-o" title="分享给朋友" is-link url=""  @click="showShare=true"/>
    <van-cell icon="setting-o" title="设置" is-link url="" to="setting" />
    <!-- 分享 -->
    <van-share-sheet
    v-model="showShare"
    title="立即分享给好友"
    :options="options"
  />
  </div>
</template>
<script>
import 'vant/lib/index.less'
import { ImagePreview } from 'vant'
export default {
  name: 'MyIndex',
  props: {},
  data () {
    return {
      defaultImg: 'https://img01.yzcdn.cn/vant/cat.jpeg',
      showShare: false,
      options: [
        [
          { name: '微信', icon: 'wechat' },
          { name: '朋友圈', icon: 'wechat-moments' },
          { name: '微博', icon: 'weibo' },
          { name: 'QQ', icon: 'qq' }
        ],
        [
          { name: '复制链接', icon: 'link' },
          { name: '分享海报', icon: 'poster' },
          { name: '二维码', icon: 'qrcode' },
          { name: '小程序码', icon: 'weapp-qrcode' }
        ]
      ]
    }
  },
  methods: {
    ImagePreview () {
      ImagePreview({
        images: [
          this.$store.state.user.userDetailInfo.avarta || this.defaultImg
        ],
        closeable: true
      })
    }
  }

}
</script>

<style scoped lang="less">
  .my-container {
    .avatar_info{
      display: flex;;
    }
.base-info {
      height: 231px;
      width: 80%;
      // padding: 76px 32px 23px;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .left {
        display: flex;
        align-items: center;
        .avatar {
          width: 150px;
          height: 150px;
          border: 4px solid #fff;
          margin-right: 23px;
        }
        .span{
          font-size: 30px;
        }
      }
      .right{
        button{
          font-size: 20px;
          padding: 0px 20px;
        }
      }
    }

  }
 .grid-nav {
    .grid-item {
      height: 141px;
      i.toutiao {
        font-size: 45px;
      }
      .toutiao-shoucang {
        color: #eb5253;
      }
      .toutiao-lishi {
        color: #ff9d1d;
      }
      span.text {
        font-size: 28px;
      }
    }
  }
</style>
